package utilities;

import com.jme3.audio.AudioNode;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.SceneGraphVisitor;
import com.jme3.scene.Spatial;

/**
 * Adapted from JME3 SceneGraphVisitorAdapter.  Added the ability to
 * distinguish between Nodes and AudioNodes
 * @author RJ
 *
 */
public class SceneGraphVisitorAdapter2 implements SceneGraphVisitor {

	/**
     * Called when a {@link Geometry} is visited.
     * 
     * @param geom The visited geometry
     */
    public void visit(Geometry geom) {}
    
    /**
     * Called when a {@link Node} is visited.
     * 
     * @param geom The visited node
     */
    public void visit(Node node) {}
    
    public void visit(AudioNode node) {}

    @Override
    public final void visit(Spatial spatial) {
        if (spatial instanceof Geometry) {
            visit((Geometry)spatial);
        } 
        else if (spatial instanceof AudioNode){
            visit((AudioNode)spatial);
        }
        else {
        	visit((Node)spatial);
        }
    }
	
}
